home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / private / _print.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.9 KB  |  83 lines

  1. #define    CURSES_LIBRARY    1
  2. #define NEEDS_OS2       1
  3. #include <curses.h>
  4.  
  5. #ifdef PDCDEBUG
  6. char *rcsid__print = "$Header: C:\CURSES\private\RCS\_print.c 2.1 1993/06/18 20:23:31 MH Rel MH $";
  7. #endif
  8.  
  9. #ifdef OS2
  10. #  if !defined (CURSES__32BIT__) && !defined(CSET2) && !defined(MSC) &&!defined(TC)
  11. #define INCL_DOS
  12. #include <bsedos.h>
  13. #endif
  14. char Printer[]="LPT1:";
  15. #endif
  16.  
  17.  
  18. /*man-start*********************************************************************
  19.  
  20.   PDC_print()    - Provides primitive access to the BIOS printer functions
  21.  
  22.   PDCurses Description:
  23.      This is a private PDCurses routine.
  24.  
  25.      Implements write/init/read printer services at the BIOS level.
  26.  
  27.      This provides the basic support that PDCurses needs to dump the
  28.      contents of windows or pads to the printer attached to the BIOS
  29.      printer port.
  30.  
  31.   PDCurses Return Value:
  32.      See the BIOS INT 0x17 specifications.
  33.  
  34.   PDCurses Errors:
  35.      See the BIOS INT 0x17 specifications.
  36.  
  37.   Portability:
  38.      PDCurses    int PDC_print( int cmd, int byte, int port );
  39.  
  40. **man-end**********************************************************************/
  41.  
  42. int    PDC_print(int cmd, int byte, int port)
  43. {
  44. #ifdef    OS2
  45. #  if !defined (CURSES__32BIT__) && !defined(CSET2) && !defined(TC)
  46.     HFILE Lpt;
  47.     USHORT Action;
  48.     USHORT NoWritten;
  49. #  endif
  50. #endif
  51.  
  52. #ifdef    DOS
  53.     int    status = 0;
  54. #endif
  55.  
  56. #ifdef PDCDEBUG
  57.     if (trace_on) PDC_debug("PDC_print() - called\n");
  58. #endif
  59.  
  60. #ifdef    FLEXOS
  61.     return( OK );
  62. #endif
  63.  
  64. #ifdef    DOS
  65.     regs.h.ah = (unsigned char)cmd;
  66.     regs.h.al = (unsigned char)byte;
  67.     regs.x.dx = (unsigned int)port;
  68.     int86(0x17, ®s, ®s);
  69.     status = regs.h.ah;
  70.     return (status);
  71. #endif
  72.  
  73. #ifdef    OS2
  74. #  if !defined (CURSES__32BIT__) && !defined(CSET2) && !defined(TC)
  75.     if (DosOpen((PSZ)Printer, &Lpt, &Action, 0,0,0,0,0) != 0)
  76.         return(ERR);
  77.     DosWrite(Lpt,&byte,1,&NoWritten);
  78.     DosClose(Lpt);
  79.     return(NoWritten == 1);
  80. #  endif
  81. #endif
  82. }
  83.